home *** CD-ROM | disk | FTP | other *** search
- Path: unixg.ubc.ca!news
- From: csmecher@unixg.ubc.ca (Alec or Graeme Smecher)
- Newsgroups: comp.lang.c++
- Subject: Help with screen blit function please!
- Date: Fri, 05 Jan 1996 02:40:01 GMT
- Organization: The University of British Columbia
- Message-ID: <4ci2qu$ntc@nntp.ucs.ubc.ca>
- Reply-To: csmecher@unixg.ubc.ca
- NNTP-Posting-Host: port10.annex2.net.ubc.ca
- X-Newsreader: Forte Free Agent 1.0.82
-
- Could somebody please tell me what is wrong with this screen blitter?
- I'll set the stage: This function is supposed to move 64,000 bytes
- from the address of "vscreen", into the VGA's screen segment
- (0xa000:0). When I run this program, I get a hang in dos, and a
- general protection fault in windows.
-
- The example_vscreen is being allocated sucessfully and freed
- successfully after completion. Even if it wasn't being allocated
- properly, it wouldn't matter because it is being read from, not
- written to.
-
- void *example_vscreen = malloc (64000);
-
- void blit(void *vscreen) {
- asm {
- pusha
- cld
-
- mov ax,0xa000 // es=0xa000
- mov es,ax
-
- xor ax,ax // di=0
- mov di,ax
- // ES:DI is now 0xa000:0
-
- mov ax,SEG vscreen
- mov ds,ax
- // ds:si = segment and offset of vscreen
- mov ax,OFFSET vscreen
- mov si,ax
-
- mov cx,32000 // Loop 32000 times
- rep movsw // Do it
-
- popa
- };
- }
-
- I'm relatively new to assembler, but pretty experienced in DOS C++
- coding (borland C++). Could somebody please tell me what is wrong with
- this code?
-
- All answers appreciated!!
-
- Thanks in advance,
- Alec Smecher (UBC, British Columbia, Canada)
- csmecher@unixg.ubc.ca
-
-